> I am considering writer (yet another...) football management simulation, one of the stumbling blocks being how to generate the set of fixtures. There must be a
>
> Say, for example, there were 8 teams in a division, first week would be:
>
> (Home team no. v Away team no.)
>
> 1 v 2
> 3 v 4
> 5 v 6
> 7 v 8
>
> 2nd week:
>
> 1 v 3
> 2 v 4
> 5 v 7
> 6 v 8
>
> but where from now? with 8 teams i could simply work out by hand how to achieve this, but with
>
> Anyone encountered this problem before?
>
> Martin
there's a math formula from combinatorial analysis theory which computes the number combination
of A (in this case 2, since only 2 teams play against each other) objects out of N (in this case
it's 20). this gives you all possible combinations possible for all teams, that means that each
team plays against all other teams exactly once. then you could simply choose at random a group
of these fixtures to play at a certain week.
the formula if memory serves is: C = N!/A!*(N-A)! where ! stands for the factorial function.